using System.Diagnostics.CodeAnalysis;

namespace Beaker.Injection
{
	public interface IInjectionManager
	{
		/// <summary>
		/// Search all assemblies (using MEF) in the base directory of the current appdomain and let them register their modules with DI.
		/// </summary>
		/// <param name="skipVerify">Set to true to skip the verify phase.</param>
		/// <returns>The created injection container where all found modules are registerd.</returns>
		[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
		IQueryContainer SearchAndRegisterModules(bool skipVerify = false);

		/// <summary>
		/// Search all assemblies (using MEF) in the given folder and let them register their modules with DI.
		/// </summary>
		/// <param name="folderPath">The folder to search for assemblies.</param>
		/// <param name="skipVerify">Set to true to skip the verify phase.</param>
		/// <returns>The created injection container where all found modules are registerd.</returns>
		[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
		IQueryContainer SearchAndRegisterModules(string folderPath, bool skipVerify = false);

		/// <summary>
		/// Calls the <see cref="IInitialization.Initialize"/> method of all instances that are registered as <see cref="IInitialization"/> with with <see cref="IContainerBuilder.RegisterAnother{TService,TImplementation}"/>
		/// </summary>
		/// <param name="container">The container to use to find all modules.</param>
		void InitializeModules(IQueryContainer container);

		/// <summary>
		/// Call the <see cref="ICleanup.Cleanup"/> method of all instances that are registered as <see cref="IContainerBuilder.RegisterAnother{TService,TImplementation}"/> with <see cref="IContainerBuilder"/>
		/// </summary>
		/// <param name="container">The container to use to find all modules.</param>
		void CleanupModules(IQueryContainer container);
	}
}